<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>实现"求100以内的素数"</title>
</head>
<body>

</body>
<script type="text/javascript">
    arr = []
    for (i = 2; i < 100; i++) {
        var k = 0;
        for (j = 2; j < 100; j++) {
            if (i % j == 0) {
                k++;
            }
        }
        if (k == 1) {
            document.write(i + "<span> </span>")
            arr.push(i)
        }
    }
    document.write("<br>素数有：" + arr.length + '个')
</script>
</html>